// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Ground.java

package FlyBird;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintStream;
import javax.imageio.ImageIO;
import javax.swing.JPanel;

// Referenced classes of package day07:
//			Bird

public class Ground extends JPanel
{

	int x;
	int y;
	int width;
	int height;
	BufferedImage ground;
	Bird b;

	public Ground()
		throws IOException
	{
		b = new Bird();
		ground = ImageIO.read(getClass().getResource("/images/ground.png"));
		x = 0;
		y = 500;
		width = ground.getWidth();
		height = ground.getHeight();
	}

	public void paint(Graphics g)
	{
		super.paint(g);
		g.drawImage(ground, x, y, width, height, null);
	}

	public void move()
	{
		x--;
		if (x == -111)
			x = 0;
		System.out.println(x);
	}

	public boolean hitBird(Bird b)
	{
		if (b.y + b.height / 2 >= y)
		{
			b.y = y - b.height / 2;
			return true;
		} else
		{
			return false;
		}
	}
}
